#ifndef CAMERA_CONTROL_H___
#define CAMERA_CONTROL_H___

//class CameraControl;

#include "Player.h"
#include "PodServerInterface.h"

/*
 * Base class for all cameras used when playing the game
 */
class CameraControl
{
public:

    CameraControl(Ogre::Viewport *m_v, Ogre::Viewport *l_v, Ogre::Viewport *r_v,
        Ogre::SceneManager *sm, Ogre::String prefix);
    virtual ~CameraControl() {}

    // inherit to control ball with a new input device
    virtual void updateCamera(Ogre::Real time) = 0;
    
    // inherit to initialise camera when registering a ball
    virtual void registerPlayer(Player *p, OgreNewt::World *og) = 0;
    
    virtual void unregisterPlayer();
    
    virtual void setSceneNode(Ogre::SceneNode *node) {}
    virtual Ogre::Radian getCameraYaw() { return yaw; } 
    virtual Ogre::Vector3 getDirection() { return main_camera->getRealDirection(); }
    virtual Ogre::Vector3 getRight() { return main_camera->getRealRight(); }
    virtual Ogre::Vector3 getUp() { return main_camera->getRealUp(); }
    virtual Ogre::Radian getOriginalPitch() { return original_pitch; }
    virtual Ogre::Quaternion getSkyOrientation();
    Ogre::Vector3 getInitialDirection() { return initial_direction; }
    virtual void reset();
    void usePod(PodServerInterface *p) { pod = p; }
    void rotate(Ogre::Radian y);

protected:
    Player *player;
    PodServerInterface *pod;
    Ogre::Radian yaw, pitch, roll;
    Ogre::SceneNode *main_node;
    Ogre::Camera *main_camera, *left_camera, *right_camera;
    Ogre::Viewport *main_viewport, *left_viewport, *right_viewport;
    Ogre::Radian original_pitch, extra_pitch;
    Ogre::Vector3 initial_direction;
    float previous_scale;
} ;

#endif

